<script>
<% if !defined?(secondrun) or !secondrun %>
Event.observe(window, 'load', function() {
<% end %>
  flashembed("videoPlayer<%= videoid %>",
  {
    src:'/flash/flowplayer.swf?123',
    width: 640,
    height: 480,
    wmode: 'transparent',
    version: [9,115],
    onFail: function(flashVersion, flowplayerConfig) {
      this.version = null;
      this.onFail = null;
      this.width = 480;
      this.height = 360;
      flowplayerConfig = {
        config: {
          playList: [
            { url: '<%= image %>', overlayId: 'play' },
            { url: '<%= video %>' },
            { overlayId: 'play' }
          ],
          showStopButton: true,
          autoRewind: false,
          autoPlay: false,
          autoBuffering: false,
          initialScale: 'scale'
        }
      };
      flashembed("videoPlayer<%= videoid %>", this, flowplayerConfig);
    }
  },
  {
    config: {
      playList: [
        { url: '<%= image %>', overlayId: 'play' },
        { url: '<%= highres_video %>' },
        { overlayId: 'play' }
      ],
      showStopButton: true,
      autoRewind: false,
      autoPlay: false,
      autoBuffering: false,
      initialScale: 'scale'
    }
  }
  );
<% if !defined?(secondrun) or !secondrun %>
});
<% end %>
</script>
<div id="videoPlayer<%= videoid %>"></div>
